package com.wardrobe.dao.agreement;


import com.wardrobe.domain.agreement.AgreementBean;
import com.wardrobe.domain.agreement.AgreementShowBean;
import com.wardrobe.mapper.master.agreement.AgreementMasterMapper;
import com.wardrobe.mapper.slave.agreement.AgreementSlaveMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2018/11/7.
 */
@Service
public class AgreementDao {
    @Autowired
    private AgreementMasterMapper agreementMasterMapper;
    @Autowired
    private AgreementSlaveMapper agreementSlaveMapper;

    public int insertAgreement(AgreementBean agreementBean){
        return agreementMasterMapper.insertAgreement(agreementBean);
    }

    public int updateAgreement(AgreementBean fromBean){
        return agreementMasterMapper.updateAgreement(fromBean);
    }

    public AgreementShowBean selectAgreementByType(@Param("type") int type){
        return agreementSlaveMapper.selectAgreementByType(type);
    }

    public List<AgreementShowBean> selectAgreement(){
        return agreementSlaveMapper.selectAgreement();
    }

    public int deleteAgreementById(int id){
        return agreementMasterMapper.deleteAgreementById(id);
    }
}
